/**
 * @Author: SevDaisy十七散人 
 * @Date: 2020-07-06 10:01:33
 */
package zyy.ui;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import zyy.util.Bus;

public class FrmLoading extends JFrame implements ActionListener {
  private static final long serialVersionUID = 3058954350219268230L;
  private ImageIcon img = new ImageIcon("asset/希欧SP.jpeg");
  private JLabel imgLabel = new JLabel();
  private JLabel markName = new JLabel("31801146 计算机1803 章一砚");
  private JLabel copyright = new JLabel("浙ICP备20018018号@www.zdiml.xyz:520");
  private JPanel namePanel = new JPanel();
  private JPanel rightPanel = new JPanel();
  private JPanel text = new JPanel();
  private JPanel content = new JPanel();
  private JButton start = new JButton("启动程序");
  private JButton exit = new JButton("退出程序");
  private JPanel buttons = new JPanel();

  public FrmLoading() {
    {
      content.setLayout(new BorderLayout());
      text.setLayout(new BorderLayout());
      buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
      namePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
      rightPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
      this.getContentPane().add(buttons, BorderLayout.SOUTH);
      this.getContentPane().add(content, BorderLayout.CENTER);
      content.add(text, BorderLayout.SOUTH);
      content.add(imgLabel, BorderLayout.CENTER);
      imgLabel.setIcon(img);
      namePanel.add(markName);
      rightPanel.add(copyright);
      text.add(namePanel, BorderLayout.CENTER);
      text.add(rightPanel, BorderLayout.SOUTH);
      // namePanel.setBackground(new java.awt.Color(0x272822));
      // namePanel.setBackground(null);
      // namePanel.setOpaque(false);
      // rightPanel.setBackground(null);
      // rightPanel.setOpaque(false);
      // buttons.setBackground(null);
      // buttons.setOpaque(false);
      // text.setBackground(null);
      // text.setOpaque(false);
      // this.getContentPane().setBackground(null);
      // ((JComponent) this.getContentPane()).setOpaque(false);
      buttons.add(start);
      buttons.add(exit);
    }
    {
      // start.setContentAreaFilled(false);
      // start.setBorderPainted(false);
      Bus.jButtonZYYStyle(start);
      Bus.jButtonZYYStyle(exit);
    }
    {
      this.setTitle("外卖助手 启动界面");
      // this.setExtendedState(JFrame.MAXIMIZED_BOTH);
      this.setSize(1318, 838);
      this.setLocationRelativeTo(null);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      this.setVisible(true);
    }
    {
      this.start.addActionListener(this);
      this.exit.addActionListener(this);
    }
  }

  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == this.exit) {
      System.exit(0);
    } else if (e.getSource() == this.start) {
      new FrmMain();
    }
  }

  public static void main(String[] args) {
    new FrmLoading();
  }
}